import React from 'react'
import {
    View,
    Text,
    Image,
    TouchableOpacity,
    TextInput,
    StyleSheet,
}from 'react-native'

import BasePage from '../BasePage'
import NavigationBar from 'teaset/components/NavigationBar/NavigationBar';
import Toast from 'teaset/components/Toast/Toast';
import CommonStyle from '../CommonStyle'
export default class FeedbackPage extends BasePage{
    constructor(props) {
        super(props);
        this.state = { text: ' ' };
      }
    renderNavigationBar() {
        return (
            <NavigationBar
                style={{backgroundColor: 'white',}}

                title={
                    <View style={{
                        flexDirection: 'row',
                        justifyContent: 'center',
                        alignSelf: 'center',

                    }}>
                        <Text style={{
                            fontSize: 20,
                            color: '#333333'
                        }}>意见反馈</Text>
                    </View>}

                leftView={<TouchableOpacity
                    onPress={() => {


                        this.navigator.pop();


                        // DeviceEventEmitter.emit('my', {text: '刷新'})

                    }}
                >
                    <Image style={{width: 15, height: 15, marginLeft: 20}} source={require('../images/btn_back.png')}/>

                </TouchableOpacity>}

            />

        );
    }

    renderPage(){
        return (
            <View style={{flex:1,backgroundColor:'#f2f2f2',marginTop:CommonStyle.statusBarAndNavigationBarH+10}}>
                <TextInput style={{marginTop:10,marginLeft:10,marginRight:10,height:120,backgroundColor:'white'}} multiline={true}  placeholder={'请输入反馈内容'} onChangeText={(text) => this.setState({text})} />
                <TouchableOpacity style={{marginTop:160,marginLeft:40, marginRight:40, height:50,borderRadius:10,backgroundColor:'white'}}
                onPress={()=>{
                    if(this.state.text.length<10){
                        Toast.message('反馈内容不能低于10字')
                    }else{
                        Toast.success('我们已收到您的反馈，谢谢')
                        this.navigator.pop()
                    }
                }}
                >
                    <Text style={{textAlign:'center',marginTop:20}}>提交</Text>
                </TouchableOpacity>
            </View>
        );
    }
}